'use strict';

module.exports = app => {
  const { STRING, INTEGER, TEXT, DATE } = app.Sequelize;

  const user = app.model.define('User', {
    id: {
      field: 'id',
      type: INTEGER,
      primaryKey: true,
    },
    accountName: {
      field: 'account_name',
      type: STRING(50),
    },
    password: {
        field: 'password',
        type: STRING(50),
    },
    role: {
      type: STRING(10),
  },
    nickName: {
      field: 'nick_name',
      type: STRING(50),
    },
    headImgUrl: {
      field: 'head_img_url',
      type: STRING(250),
    },
    location: {
      field: 'location',
      type: STRING(250),
    },
    idCard: {
      field: 'id_card',
      type: STRING(20),
    },
    mobile: {
      field: 'mobile',
      type: STRING(12),
    },
    email: {
      type: STRING(50),
    },
    createBy: { field: 'create_by', type: STRING(50), allowNull: true },
    createDate: { field: 'create_date', type: DATE, allowNull: true },
    updateBy: { field: 'update_by', type: STRING(50), allowNull: true },
    updateDate: { field: 'update_date', type: DATE, allowNull: true },
  },
    {
      timestamps:false,
      tableName: 'user',
      created_at: false,
      updated_at:false,
     
    });

  return user;
};

